package cn.iocoder.yudao.module.member.dal.mysql.invitationcode;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.member.controller.admin.invitationcode.vo.InvitationCodePageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.invitationcode.InvitationCodeDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 邀请码 Mapper
 *
 * @author Alan
 */
@Mapper
public interface InvitationCodeMapper extends BaseMapperX<InvitationCodeDO> {

    default PageResult<InvitationCodeDO> selectPage(InvitationCodePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<InvitationCodeDO>()
                .eqIfPresent(InvitationCodeDO::getNumber, reqVO.getNumber())
                .eqIfPresent(InvitationCodeDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(InvitationCodeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(InvitationCodeDO::getId));
    }

}